home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / PPCExamples / CExamples / NotPPC / NotPPC.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-03  |  1.6 KB  |  68 lines  |  [TEXT/MPS ]

  1. /*
  2.  
  3.     NotPPC.c
  4.  
  5.         Source code for NotPPC application.
  6.  
  7. */
  8.  
  9. #include <TextUtils.h>
  10. #include <Sound.h>
  11. #include <Fonts.h>
  12. #include <Gestalt.h>
  13. #include <Resources.h>
  14.  
  15. #include "NotPPC.h"
  16.  
  17. /* Not defined in {CIncludes} */
  18.     
  19. #define gestaltSysArchitecture 'sysa'
  20. #define gestalt68k 1
  21.  
  22. QDGlobals    qd;
  23.  
  24. void main ()
  25. {
  26.     long        Architecture;
  27.     OSErr       err;
  28.     short        itemHit;
  29.     AlertTHndl    theAlertTemplate;
  30.     Handle        theDITLHandle;
  31.     Str255        theMessage;
  32.  
  33.     InitGraf ((Ptr) &qd.thePort);
  34.     InitFonts ();
  35.     InitWindows ();
  36.     InitMenus ();
  37.     TEInit ();
  38.     InitDialogs (nil);
  39.     InitCursor ();
  40.     
  41.     /* set cursor to an arrow */
  42.     SetCursor (&qd.arrow);
  43.  
  44.     /* pre-flight everything first */
  45.     theAlertTemplate = (AlertTHndl)GetResource ('ALRT', RESOURCE_ID);        /* is the ALRT resource around? */
  46.     if (theAlertTemplate)
  47.          theDITLHandle = GetResource ('DITL', (*theAlertTemplate)->itemsID);    /* How about the DITL? */
  48.        
  49.     err = Gestalt (gestaltSysArchitecture, & Architecture);                 /* Which message to print? */
  50.     if (err || (Architecture == gestalt68k) )
  51.         GetIndString (theMessage, RESOURCE_ID, Mac68KmsgID);
  52.      else
  53.        GetIndString (theMessage, RESOURCE_ID, PowerMacMsgID);
  54.  
  55.     if ((theAlertTemplate) && (theDITLHandle) && (theMessage[0] != 0))
  56.     {
  57.         /* Success at last... */
  58.     
  59.         ParamText (theMessage, (ConstStr255Param) "\p",                 /* Use the loaded STR resource to replace */
  60.                    (ConstStr255Param) "\p", (ConstStr255Param) "\p");    /*    ^0 in alert's DITL. */    
  61.         itemHit = Alert (RESOURCE_ID, nil);                                /* Run the alert. */
  62.     }
  63.     else
  64.     {
  65.         /* give some indication we're hosed... */
  66.         SysBeep(2); 
  67.     }
  68. }